package com.alifi.crm.dal.guess;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.alifi.crm.dal.IbatisCRUDDAO;
import com.alifi.crm.dal.object.RedEnvelopeCountDO;



@Repository("redEnvelopeCountDAO")
public class RedEnvelopeCountDAOImpl extends IbatisCRUDDAO<RedEnvelopeCountDO> implements RedEnvelopeCountDAO{

	@Override
	protected String getNamespace() {
		return "act_red_envelope_count";
	}

	@Override
	public RedEnvelopeCountDO selectByRedEnvelopDate(String redEnvelopDate) {
		Map<String,String> map = new HashMap<String,String>();
		map.put("redEnvelopDate", redEnvelopDate);
		return (RedEnvelopeCountDO)this.getSqlMapClientTemplate().queryForObject(this.genStmt("selectByRedEnvelopDate"),map);
	}

	@Override
	public Long getLockByRedEnvelopDate(String redEnvelopDate) {
		Map<String,String> map = new HashMap<String,String>();
		map.put("redEnvelopDate", redEnvelopDate);
		return (Long)this.getSqlMapClientTemplate().queryForObject(this.genStmt("getLockByRedEnvelopDate"),map);
	}

	@Override
	public Long releaseLockByRedEnvelopDate(String redEnvelopDate) {
		Map<String,String> map = new HashMap<String,String>();
		map.put("redEnvelopDate", redEnvelopDate);
		return (Long)this.getSqlMapClientTemplate().queryForObject(this.genStmt("releaseLockByRedEnvelopDate"),map);
	}

	@Override
	public RedEnvelopeCountDO selectByIdForUpdate(Long id) {
		return (RedEnvelopeCountDO)this.getSqlMapClientTemplate().queryForObject(this.genStmt("selectByIdForUpdate"),id);
	}
	

}
